﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPainter>
#include<QMouseEvent>
#include<QDebug>
#include<QEvent>
#include<QColorDialog>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void paintEvent(QPaintEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseDoubleClickEvent(QMouseEvent *event) override;
    void enterEvent(QEvent *event) override;
    void  leaveEvent(QEvent *event) override;
    bool event(QEvent *event) override;
    enum shape
    {
        line,
        rect,
        circle,
        fiveagon,
        path,
        clear
    };

private slots:
    void on_pushButton_clicked();
    void on_pushButton_2_clicked();
    void on_pushButton_3_clicked();
    void on_pushButton_4_clicked();
    void on_pushButton_5_clicked();
    void on_pushButton_6_clicked();
    void on_pushbutton_7_clicked();
    void on_horizontalSlider_valueChanged(int value);
    void  outString(QString str);
signals:
    void wxx_signal(QString str);
private:
    Ui::MainWindow *ui;
    enum shape it;
    QVector<QLine> track;
    QPoint pre_pos;
    QColor color;
    int lineSize=0;
};
#endif // MAINWINDOW_H
